package cn.yuanqiao.web.controller.archive.storeRoom;

import cn.yuanqiao.archive.storeRoom.domain.StoreRole;
import cn.yuanqiao.archive.storeRoom.domain.UserRole;
import cn.yuanqiao.archive.storeRoom.service.IStoreRoleService;
import cn.yuanqiao.common.web.controller.BaseController;
import cn.yuanqiao.common.core.domain.AjaxResult;
import cn.yuanqiao.common.web.page.TableDataInfo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 库房权限Controller
 *
 * @author xy
 * @date 2023-06-20
 */
@RestController
@RequestMapping("/archive/storeRole")
public class StoreRoleController extends BaseController
{
    @Autowired
    private IStoreRoleService storeRoleService;


    /**
     * 查询库房权限列表
     */
    @GetMapping("/list")
    public TableDataInfo list(StoreRole storeRole)
    {
        /*startPage();*/
        List<StoreRole> list = storeRoleService.selectStoreRoleList(storeRole);
        return getDataTable(list);
    }

/*
    @PreAuthorize("@ss.hasPermi('storeroom:storeRole:userList')")
*/
    @GetMapping("/userList")
    public TableDataInfo userList()
    {
      /*  startPage();*/
        List<UserRole> list = storeRoleService.selectStoreUserList();
        return getDataTable(list);
    }

    /**
     * 档案树
     */
    @PostMapping("/getTreeList")
    public AjaxResult getTreeList(){
        List list=storeRoleService.getTreeList();
        return success(list);
    }




    /**
     * 导出库房权限列表
     */
/*    @PreAuthorize("@ss.hasPermi('storeroom:storeRole:export')")
    @Log(title = "库房权限", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, StoreRole storeRole)
    {
        List<StoreRole> list = storeRoleService.selectStoreRoleList(storeRole);
        ExcelUtil<StoreRole> util = new ExcelUtil<StoreRole>(StoreRole.class);
        util.exportExcel(response, list, "库房权限数据");
    }*/


}
